import {request} from 'umi';
import {getApiPrefix} from "@/assets/utils/utils";
import {modulesUrl} from "@/assets/constant/modulesUrl";
import {PageAnalysis} from "@/pages/analysis/PageAnalysis/data";

/**
 * 获取Url列表
 * @param params
 */
export async function allUrl() {
  return request(getApiPrefix(modulesUrl.analysisPage) + "/allUrl");
}

/**
 * 获取子节点
 * @param params
 */
export async function listChildren(params?: PageAnalysis) {
  return request(getApiPrefix(modulesUrl.analysisPage) + "/listChildren", {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 总汇总
 * @param params
 */
export async function sum(params?: PageAnalysis) {
  return request(getApiPrefix(modulesUrl.analysisPage) + "/sum", {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 按天汇总
 * @param params
 */
export async function sumByDay(params?: PageAnalysis) {
  return request(getApiPrefix(modulesUrl.analysisPage) + "/sumByDay", {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 按地市汇总
 * @param params
 */
export async function sumByCity(params?: PageAnalysis) {
  return request(getApiPrefix(modulesUrl.analysisPage) + "/sumByCity", {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 按地市和日期汇总
 * @param params
 */
export async function sumByCityAndDay(params?: PageAnalysis) {
  return request(getApiPrefix(modulesUrl.analysisPage) + "/sumByCityAndDay", {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 导出
 * @param params
 */
export async function exportExcel(params?: PageAnalysis) {
  return request(getApiPrefix(modulesUrl.analysisPage) + "/exportExcel", {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
